package com.xiaolun.controller;

import com.xiaolun.entity.Order;
import com.xiaolun.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @time: 2020-12-01 17:21
 * @author: likunlun
 * @description: controller层查询订单表
 */
@Controller
public class OrderListController {

	@Autowired
	private OrderService orderService;

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	@ResponseBody
	public Object listShow() {
		List<Order> orderList = this.orderService.findAll();
		System.out.println("-------------------------------------");
		System.out.println(orderList);
		//通过下面的方式可以讲数据返回
		return orderList;
	}
}
